<%@page import="java.io.Console"%>
<%@page import="jdbc.DBOUser"%>
<%@page import="HumanM.PUser"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>修改密码逻辑处理页面</title>
</head>
<body>

<%
   PUser user=(PUser)session.getAttribute("user");
	String pass1 = request.getParameter("password");
	String pass2 = request.getParameter("npassword");
	String pass3 = request.getParameter("npassword1");
	
	DBOUser dbu1=new DBOUser();
	user = dbu1.Q_user_info(user.puser_name);
	user.setPuser_password(pass1);
	
	if(!dbu1.is_user_true(user))
	{   
		out.print("<script>alert('原密码错误请重试! ');window.location='change_password.jsp'</script>");
	}else if(!pass2.equals(pass3))
	{
		out.print("<script>alert('新密码两次输入不一致！请重试！');window.location='change_password.jsp'</script>");
		
	}else{
		DBOUser dbu= new DBOUser();
		dbu.change_user_password(user.puser_id, pass2);
		out.print("<script>alert('密码修改成功！请保管好密码！');window.location='user_info.jsp'</script>");
	}
	
	
	
	
%>




</body>
</html>